<!doctype html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
    <link href="focus-indicator.css" rel="stylesheet" type="text/css" />
    <script crossorigin="anonymous" src="/test-harness.js"></script>
    <script crossorigin="anonymous" src="/test-page-object.js"></script>
    <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
  </head>
  <body>
    <main id="webchat"></main>
    <script>
      run(async function () {
        const directLine = WebChat.createDirectLine({ token: await testHelpers.token.fetchDirectLineToken() });
        const store = testHelpers.createStore();

        WebChat.renderWebChat(
          { directLine, store, styleOptions: { sendAttachmentOn: 'send' } },
          document.getElementById('webchat')
        );

        await pageConditions.uiConnected();

        // WHEN: Upload button is clicked and a JPEG file is selected.
        await host.upload(pageElements.uploadButton(), 'seaofthieves.jpg');

        // THEN: A checkmark should show next to the "upload button".
        await host.snapshot();

        // WHEN: Send button is clicked.
        await host.click(pageElements.sendButton());

        // THEN: A thumbnail with the bot reply should show.
        await pageConditions.numActivitiesShown(2);
        await pageConditions.allOutgoingActivitiesSent();
        await host.snapshot();
      });
    </script>
  </body>
</html>
